package com.homework.test3;

public class Demo4 {
    public static void main(String[] args) {
        int[] arr = {95, 92, 75, 56, 98, 71, 80, 58, 91, 91};

        int[] arr2 = getArr2(arr);
        for (int i : arr2) {
            System.out.print(i+" ");
        }
    }

    private static int[] getArr2(int[] arr) {
        int[] arr2 = new int[arr.length];
        int ji = 0;
        int ou = arr.length-1;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]%2!=0){
                arr2[ji] = arr[i];
                ji++;
            }else {
                arr2[ou]= arr[i];
                ou--;
            }
        }
        return arr2;
    }
}
